package com.example.musicproject_b.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfiguration implements WebMvcConfigurer {

    /*
     * 解决跨域问题
     * */
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")//允许的访问路径
                .allowedOrigins("http://localhost:8080")//允许跨域的地址
                .allowCredentials(true)//带上cookies地址
                .allowedHeaders("*")
                .exposedHeaders("*");
    }

}

